/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tbgb.gesturehandle.touch;

import com.nokia.mid.ui.multipointtouch.MultipointTouch;
import tbgb.components.twodimesion.point2dimplements.Point2D;

/**
 *
 * @author LưuQuang
 */
public class TBTouch
{
    private int touchID;
    private Point2D current, last, begin;
    
    public TBTouch(int id)
    {
        this.touchID = id;
        this.current = new Point2D(MultipointTouch.getX(touchID), MultipointTouch.getY(touchID));
        this.last = new Point2D(Integer.MIN_VALUE, Integer.MIN_VALUE);
        this.begin = new Point2D(this.current.X, this.current.Y);
    }
    
    final void updateLocation()
    {
        this.last.set(this.current);
        
        this.current.X.set(MultipointTouch.getX(touchID));
        this.current.Y.set(MultipointTouch.getY(touchID));
    }

    /**
     * @return the touchID
     */
    public int getTouchID() {
        return touchID;
    }

    /**
     * @return the current
     */
    public Point2D getCurrent() {
        return current;
    }

    /**
     * @param current the current to set
     */
    public void setCurrent(Point2D current) {
        this.current = current;
    }

    /**
     * @return the last
     */
    public Point2D getLast() {
        return last;
    }

    /**
     * @param last the last to set
     */
    public void setLast(Point2D last) {
        this.last = last;
    }

    /**
     * @return the begin
     */
    public Point2D getBegin() {
        return begin;
    }

    /**
     * @param begin the begin to set
     */
    public void setBegin(Point2D begin) {
        this.begin = begin;
    }

    /**
     * @return the state
     */
    public int getState() {
        return MultipointTouch.getState(touchID);
    }
}